Shader "ShaderPractice/ComputeScreenPos2"{
    SubShader{
        Pass{
            CGPROGRAM

            #include "UnityCG.cginc"
            #pragma vertex vert
            #pragma fragment frag

            struct v2f {
                float4 pos: SV_POSITION;
                float4 screenPos: COLOR;
            };
            
            v2f vert(float4 v: POSITION){
                v2f o;
                o.pos = UnityObjectToClipPos(v);
                o.screenPos = ComputeScreenPos(o.pos);
                
                return o;
            }
            
            float4 frag(v2f i): SV_TARGET{
                float2 wcoord = i.screenPos.xy / i.screenPos.w;
                return fixed4(wcoord, 0.0, 1.0);
            }
            
            ENDCG
        }    
    }    
}